import Vue from 'vue'
import Vuex from 'vuex'
import getters from '@/store/getters'

Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    emr: [],
    curArea: {},
    itemSyn: '', // 事项中心同步
    tabIndex: 0,
    selectExports: [], // 导出中心·选中的导出数据-最多选中十条数据
    matterTab: [// 办事细则
      { name: '事项清单', isSave: false, circle: 'big' },
      { name: '目录清单', isSave: false, circle: 'lit' },
      { name: '实施清单', isSave: false, circle: 'lit' },
      { name: '上线要求', isSave: false, circle: 'big' },
      { name: '办事需知', isSave: false, circle: 'big' },
      { name: '办事表单', isSave: false, circle: 'big' },
      { name: '字段信息', isSave: false, circle: 'lit' },
      { name: '材料信息', isSave: false, circle: 'lit' },
      { name: '办事流程', isSave: false, circle: 'big' },
      { name: '附件上传', isSave: false, circle: 'big' }
    ],
    approveTab: [ // 审批细则标题内容
      { name: '审批内容', isSave: false },
      { name: '审批流程', isSave: false },
      { name: '审批结果', isSave: false }
    ],
    deptDict: []// 数据源部门、决定机构部门
  },
  actions: {
    saveEmr: ({ commit }, emr) => {
      commit('SET_EMR', emr)
    },
    saveCurArea: ({ commit }, curArea) => {
      commit('SET_CURAREA', curArea)
    },
    saveItemSyn: ({ commit }, itemSyn) => {
      commit('SET_ITEMSYN', itemSyn)
    },
    saveTabIndex: ({ commit }, tabIndex) => {
      commit('SET_TABINDEX', tabIndex)
    },
    saveSelectExports: ({ commit }, selectExports) => {
      commit('SET_SELECTEXPORTS', selectExports)
    },
    save_matterTab: ({ commit }, matterTab) => {
      commit('set_matterTab', matterTab)
    },
    save_approveTab: ({ commit }, approveTab) => {
      commit('set_approveTab', approveTab)
    },
    save_deptDict: ({ commit }, deptDict) => {
      commit('set_deptDict', deptDict)
    },
  },
  mutations: {
    SET_EMR: (state, payload) => {
      state.emr = payload
    },
    SET_CURAREA: (state, payload) => {
      state.curArea = payload
    },
    SET_ITEMSYN: (state, payload) => {
      state.itemSyn = payload
    },
    SET_TABINDEX: (state, payload) => {
      state.tabIndex = payload
    },
    SET_SELECTEXPORTS: (state, payload) => {
      state.selectExports = payload
    },
    set_matterTab: (state, payload) => {
      state.matterTab = payload
    },
    set_approveTab: (state, payload) => {
      state.approveTab = payload
    },
    set_deptDict: (state, payload) => {
      state.deptDict = payload
    },
  },
  getters,
  modules: {

  }
})
export default store